package fetchjoyo;
/*
 * @(#)Test.java
 *
 * Copyright 2011 Xinhua Online, Inc. All rights reserved.
 */


import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.GetMethod;

class A{
	int a=1;
}
class B extends A{
	int a=2;
	
	public static void main(String[] args) {
		A a = new B();
		System.out.println(a.a);
	}
}

/**
 * description
 * @author  liuan
 * @version 1.0,2011-2-21
 */
public class test {
	public static void main(String[] args) throws Exception {
		
//		Map mm = new HashMap();
//		mm.put("a", new test());
//		Map m = new HashMap();
//		m.put("a", new test());
//		System.out.println(m.hashCode());
//		System.out.println(mm.hashCode());
//		System.out.println("aaa".hashCode());
//		System.out.println("aaa".hashCode());
//		System.out.println(new String("aaa").hashCode());
//		System.out.println(new String("aaa").hashCode());
//		System.out.println(new String("aaa") == new String("aaa"));
//		
//		int i = 0;
//		for(String s:"1.20".split("\\.")){
//			System.out.println("-- : "+s);
//			System.out.println(i++);
//		}
		
		
		solrTest();
		
	}
	
	public static void solrTest() throws UnsupportedEncodingException{
		SimpleDateFormat sdf =new SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");

		HttpClient client = new HttpClient();
		String url=null;
		url = "http://10.1.2.47:8004/search/select/?q=SELL_PRICE:"+URLEncoder.encode("[1 TO *]","UTF-8") + "&version=2.2&start=0&rows=10&indent=on&qwerty=qwerty";
//		System.out.println(url);
		GetMethod method = new GetMethod(url);
		for(int i = 0; true; i++){
				int status;
				try {
					status = client.executeMethod(method);
					if(status != 200){
						System.out.println("status="+status + "  " + sdf.format(new Date()));
						return;
					}
				} catch (Exception e) {
					// TODO Auto-generated catch block
					e.printStackTrace();

				}
				System.out.println(i + "  " + sdf.format(new Date()));
//				try {
//					Thread.sleep(100);
//				} catch (InterruptedException e) {
//					// TODO Auto-generated catch block
//					e.printStackTrace();
//				}
		}
	
	
	}
	
	public static String getAuthorsUrl(final String a){
		String returnAuthor = "沃尔特.艾萨克森";
		String[] authors = {"沃尔特","艾萨克森"};
		for(String author : authors){
			String aReplace;
			try {
				aReplace = a.replaceFirst("href=\"\"", "href=\"http://search.winxuan.com.search?author="+ URLEncoder.encode(author , "UTF-8") +"\"")
						.replaceFirst("></a>", ">"+ author +"</a>");
				returnAuthor = returnAuthor.replaceAll(author,aReplace);
			} catch (Exception e) {
			}
		}
		return returnAuthor;
	}
	
	public static void sys(char a){
		System.out.println(a);
	}
}
